<template>
  <edit-layout ref="layout" :page="page" :form="form" @invoke="invoke">
    <el-form ref="form" :model="form" :size="page.settings.formSize" :label-width="page.settings.labelWidth">
      <el-divider content-position="left">基础资料</el-divider>
      <el-form-item label="用户名：" prop="username">
        <label>{{ form.username }}</label>
      </el-form-item>
      <el-form-item v-if="form.companyName" label="机构名称：" prop="companyName">
        <label>{{ form.companyName }}</label>
      </el-form-item>
      <el-form-item label="真实姓名：">
        <label>{{ form.realname }}</label>
      </el-form-item>
      <el-form-item label="身份证：">
        <label>{{ form.idCardNumber }}</label>
      </el-form-item>
      <el-form-item label="证件照：">
        <el-image
          fit="contain"
          :src="form.identityCardImgFront"
          :preview-src-list="[form.identityCardImgFront,form.identityCardImgReverse,form.identityCardImgInHand]"
        />
        <el-image
          fit="contain"
          :src="form.identityCardImgReverse"
          :preview-src-list="[form.identityCardImgFront,form.identityCardImgReverse,form.identityCardImgInHand]"
        />
        <el-image
          fit="contain"
          :src="form.identityCardImgInHand"
          :preview-src-list="[form.identityCardImgFront,form.identityCardImgReverse,form.identityCardImgInHand]"
        />
      </el-form-item>
      <div v-if="form.certifiedType===1">
        <el-divider content-position="left">个体户相关资质</el-divider>
        <el-row>
          <el-col :span="6">
            <el-form-item label="营业执照：">
              <el-image
                fit="contain"
                :src="form.license"
                :preview-src-list="[form.license]"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="经营许可证：">
              <el-image
                fit="contain"
                :src="form.openingBankPermits"
                :preview-src-list="[form.openingBankPermits]"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div v-if="form.certifiedType===2">
        <el-divider content-position="left">企业相关资质</el-divider>
        <el-row>
          <el-col :span="6">
            <el-form-item label="营业执照：">
              <el-image
                fit="contain"
                :src="form.license"
                :preview-src-list="[form.license]"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="税务登记证：">
              <el-image
                fit="contain"
                :src="form.taxRegistrationCertificate"
                :preview-src-list="[form.taxRegistrationCertificate]"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="组织机构代码证：">
              <el-image
                fit="contain"
                :src="form.organizationCode"
                :preview-src-list="[form.organizationCode]"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="经营许可证：">
              <el-image
                fit="contain"
                :src="form.openingBankPermits"
                :preview-src-list="[form.openingBankPermits]"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div v-if="baseStatus === 2">
        <el-form-item label="拒绝理由：">
          <label class="money">{{ form.rejectReason }}</label>
        </el-form-item>
      </div>

      <div v-if="baseStatus===1">
        <el-form-item label="认证" prop="status" :rules="page.rules.def">
          <el-switch
            v-model="form.status"
            active-color="#13ce66"
            inactive-color="#ff4949"
            active-value="3"
            inactive-value="2"
            active-text="通过"
            inactive-text="拒绝"
          />
        </el-form-item>
        <el-form-item v-if="form.status==2" label="拒绝理由：" prop="rejectReason" :rules="page.rules.def">
          <el-input v-model="form.rejectReason" type="textarea" :rows="2" placeholder="请输入补充描述" />
        </el-form-item>
      </div>
    </el-form>
  </edit-layout>
</template>
<script>
import adminSupport from 'lola-admin-support-el'

export default {
  name: 'CertificationApplyManageEdit',
  mixins: [adminSupport.mixins.edit],
  data() {
    return {
      name: 'CertificationApplyManage',
      baseStatus: ''
    }
  },
  mounted() {
    this.page.tip = '请认真审查相关资质信息'
    this.init()// 初始化
  },
  methods: {
    init() {
      console.log(this.upload.img)
      this.page.ids.push(this.$route.params.no)// 页面主参数赋值
      this.loadData()// 加载数据
    },
    appendForm() {
      this.baseStatus = this.form.status
      if (this.$route.params.type === 'view') {
        this.baseStatus = 0
      }
    }, buildForm() {
      return true
    },
    setArea(val) {
      // alert(val);
      this.form.area = val
    },
    buildOtherBtn(item, btn) { // 调整权限按钮
      switch (item.code) {
        case 'm0000': // 保存
        {
          btn.disable = this.form.status === 1
          break
        }
      }
    }
  }
}
</script>
